#ifndef CLIENT_LOGIN_H
#define CLIENT_LOGIN_H

#include "baseptc.h"
namespace protocal{
class ClientLogin : public BasePtc
{
public:
  ClientLogin()
  {
      this->source = CLIENT;
      this->cli_command = CLI_LOGIN;
      this->size = sizeof(ClientLogin);
  };
public:
  char username[10];
  char password[10];

public:
  int recv(int sock)
  {
      char buff[size];
      unsigned int recvsize = 0;
      unsigned int ret = 0;
      while(recvsize < this->size - sizeof(BasePtc))
      {
          ret = read(sock,buff+ sizeof(BasePtc) + recvsize,size);
          recvsize += ret;
      }
      ClientLogin * tmp = (ClientLogin *)buff;
      memcpy(this->username,tmp->username,sizeof(this->username));
      memcpy(this->password,tmp->password,sizeof(this->password));
       return recvsize;
  };
  int send(int sock)
   {
        return write(sock,this,sizeof(ClientLogin));
   };
  
};
}


#endif //CLIENT_LOGIN_H
